<template>
  <div class="y-conter">
    <div class="y-biaoge">
      <h3 class="y-bold">证件到期</h3>
      <!-- 表格部分 -->
      <div class="zhengjian-table">
        <el-table
          :border="true"
          :header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
          ref="multipleTable"
          :data="currList"
          tooltip-effect="dark"
          style="width: 98%, text-align: center "
          @selection-change="handleSelectionChange"
        >
          <el-table-column label="单位名称"  prop="buildPeople.buildCompany.company_name" align="center"></el-table-column>
          <el-table-column label="单位类型" align="center" prop="buildPeople.buildCompany.buildCompanyType.company_type_name"></el-table-column>
          <el-table-column label="姓名" width="100" align="center" prop="buildPeople.people_name"></el-table-column>
          <el-table-column label="职务" width="100" align="center" prop="buildPeople.buildJob.job_name"></el-table-column>
          <el-table-column label="证件类型" width="100" align="center" prop="people_material_name"></el-table-column>
          <el-table-column label="截至时间"  align="center" prop="buildPeople.people_created"></el-table-column>
          <el-table-column type="text" label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="text" @click="showConfirm(scope.$index, scope.row)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
     
    </div>
     <div class="y-fenye">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="tableData.length"
          :page-size="pageSize"
          @current-change="changePage"
        ></el-pagination>
      </div>
  </div>
</template>
<script>
import http from "../api";
export default {
  data() {
    return {
      //搜索输入框
      ruleForm: {
        name: "",
      },
      //表格里内容
      tableData: [],
      tableData: [], //总数居
      currPage: 1, //当前页
      pageSize: 5, //每页数据量
      currList: [], //当前展示的数据数组  
      value1: "",
      value2: "",
    };
  },
  methods: {
    // 查看
    showConfirm(index,row) {
      console.log("这是row",row)
      this.$router.push({
        name: "查看证件到期",
        params:row
      });
    },
    // 分页
    setCurrList(index) {
      this.currList = this.tableData.slice(
        (index - 1) * this.pageSize,
        index * this.pageSize
      );
      // console.log('当前页',index);
    },
    //改变当前页
    changePage(val) {
      this.currPage = val;
      this.setCurrList(val);

      // console.log(val);
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //重置
    resetForm(formName) {
      this[formName] = {};
      this.$refs[formName].resetFields();
    },
  },
  mounted() {
    http.getMaterialEndList({}).then((r) => {
      console.log(r);
      this.tableData=r.data
      this.setCurrList(1)
    });
  },
};
</script>
<style scoped>
/* 大容器 */
.y-conter {
  width: 100%;
  height: 645px;
  background-color: white;
  overflow: hidden;
  overflow-y: scroll;
  margin-top: 15px;
  position: relative;
  /* margin-left: 10px; */
}
/* 表格 */
.y-biaoge {
  margin-top: 20px;
  margin-left: 30px;
}
/* 右侧新增导出按钮 */
.y-btn {
  position: absolute;
  top: 128px;
  left: 87.3%;
}
/* 标题 */
.y-bold {
  font-weight: bold;
}
/* 按钮 */
.el-button {
  height: 30px;
  line-height: 0px;
}
/* .el-range-editor {
  height: 30px;
  width: 200px;
 text-align: center;
  
} */
.el-select >>> .el-input__inner {
  width: 178px;
  height: 30px;
  padding-left: 5px;
}
.el-input >>> .el-input__inner {
  width: 200px;
  height: 30px;
  padding-left: 5px;
}
.el-range-editor {
  width: 160px;
  height: 30px;
  padding-left: 10px;
  margin-left: 5px;
}
.el-input >>> .el-range__icon {
  line-height: 0px;
  padding-left: 10px;
}
/* 日期 */
.el-input >>> .el-input__icon {
  line-height: 30px;
}
.el-input--prefix >>> .el-input__inner {
  padding-left: 30px;
}
/* .el-range-editor >>> .el-input__inner {
  width: 200px;
  height: 30px;
  margin-left: 5px;
  margin-top: 10px;
} */
.sou {
  margin-left: 10px;
}

/* .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 300px;
} */

.block1 {
  /* margin-left: 15px; */
  height: 40px;
  line-height: 40px;
  display: inline-block;
}
.block2 {
  height: 40px;
  line-height: 40px;
  display: inline-block;
  margin-left: 10px;
}
/* 日期叉 */
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 200px;
}
.demonstration {
  margin-right: 5px;
}
.zhengjian-table {
  width: 98%;
  margin-top: 20px;
}
.y-fenye {
  /* float: right;
  margin-top: 20px; */
  position: absolute;
  right: 1%;
  bottom: 5px;
}
</style>